package com.gxa.zhonglong.controller;

import com.gxa.zhonglong.common.JsonResult;
import com.gxa.zhonglong.pojo.CustomerCostVO;
import com.gxa.zhonglong.service.CustomerCostVOService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RequestMapping("/customercost")
@CrossOrigin
@RestController
@Api(value = "客户消费查询的接口")
public class CustomerCostController {
    @Autowired
    private CustomerCostVOService customerCostVOService;
    @GetMapping("/select")
    @ApiOperation("根据条件查询客户消费情况")
    @ApiImplicitParams({
            @ApiImplicitParam(name= "type",value = "传入的类型",dataType = "String"),
            @ApiImplicitParam(name="value",value="传入的值",dataType = "String")
    })
    public Map selectByCondition(@RequestParam("type") String type,@RequestParam("value") String value){
        List<CustomerCostVO> customerCostVOS = customerCostVOService.selectByCondition(type, value);
        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode("1");
        jsonResult.setMsg("success");
        jsonResult.setData(customerCostVOS);
        return  jsonResult.getDataMap();
    }

}
